<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head>
<meta content="zh-cn" http-equiv="Content-Language">
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
<title>设置置顶</title>
<link href="0_data/infotop.css" rel="stylesheet" type="text/css">
<script language="javascript" src="0_data/jquery-1.js" type="text/javascript"></script>

<script>

var pageAmount = 0;
var selectTime = 0;
var reservepageAmount = 0;
var reserveselectTime = 0;
var userAmount =0;
var advancedmultiple =2;
var path;

$(	function(){
	pageAmount = parseFloat($("#realTime_PageAmount").val());
	selectTime = parseInt($("#realTime_FirstTimeLength").val());
	reservepageAmount = parseFloat($("#reserve_PageAmount").val());
	reserveselectTime = parseInt($("#reserve_FirstTimeLength").val());
	userAmount = parseFloat($("#newUseramount").val());
	advancedmultiple = parseFloat($("#top_advancedmultiple").val());
	
	path = $("#realTime_path").val();
	realTime_computeAmount();
	reserve_computeAmount();
	selectContent();
//	showGift();
	}
)

//前三名优惠aler
function showGift(){
	
	var sumHour=0;
	var sumAmount=0;
	var str;
	//alert($("input[name = 'realTime_giftReal']").length);
	if($("input[name = 'realTime_giftReal']").length!=0){
		$("input[name = 'realTime_giftReal']").each(function(i,obj){
		//		alert($(obj).val());
			//	alert($(obj).attr("id"));
				str = $(obj).val();
				str = str +"\n";
				var nstr = $(obj).attr("id");
				var nstrs = nstr.split("_");
				//alert(nstrs[1]);
				//alert(nstrs[0]);
				sumHour += parseFloat(nstrs[1]);
				sumAmount += parseFloat(nstrs[0]);
			}
		);
	}else{
		return;
	}
	
	sumHour = realTime_GetFloatValue(sumHour);
	sumAmount = realTime_GetFloatValue(sumAmount);
	
	str += "本次置顶共获 ";
	str += sumHour;
	str += " 小时赠送，价值 ";
	str += sumAmount;
	str += " 元"	;	

	alert(str);
}

//竞价
function compete(obj){
	
	var sel = $(obj);
	var baseprice = realTime_GetFloatValue(sel.find("option:first").val());
	var checkinput = sel.prevAll("input");
	var newprice = realTime_GetFloatValue(sel.val());
	var selectValues = checkinput.val()
	var strVal = selectValues.split("|");
	var oldprice = realTime_GetFloatValue(strVal[0]);
	var plusprice = realTime_GetFloatValue(newprice-baseprice);

	var newvalue = newprice+"|"+strVal[1];
	checkinput.val(newvalue);
	
	if(checkinput.attr("checked")==true){
		pageAmount += realTime_GetFloatValue(newprice-oldprice);
		pageAmount = realTime_GetFloatValue(pageAmount);
		$("#realTime_PageAmount").val(pageAmount);
		realTime_computeAmount();
	}
	
	var span = sel.next();
	if(plusprice>0){
		var str ="+";
		str += plusprice;
		str += "元/小时";
		span.html(str);
		span.css("display","");
	}else{
		span.css("display","none");
	}
	
}


//选择置顶类型 
function realTime_selectType(obj) {
    var type = obj.value;
    var isfull = true;
    pageAmount = 0;
    if (type == "advanced") {
    	$("#realTime_checkpagenormal").css("display","none");
    	$("#realTime_checkpageadvanced").css("display","");
    	if($("#realTime_checkpagenormal input[name='realTime_checkpage']:checked").length != 0){
    		$("#realTime_checkpagenormal input[name='realTime_checkpage']:checked").each(function(i,obj){
				$(obj).attr("checked",false);    		
    			}
    		);
    	}
    	$("#realTime_checkpageadvanced input[name='realTime_checkpage']:enabled").each(function(i,obj){
			$(obj).attr("checked",true);
			var selectValues = obj.value;
			var strVal = selectValues.split("|");
			var sConsume = strVal[0];
			pageAmount += realTime_GetFloatValue(sConsume);    	
    		}
    	);
        pageAmount = realTime_GetFloatValue(pageAmount * advancedmultiple);
    } else if (type == "normal") {
        $("#realTime_checkpagenormal").css("display","");
    	$("#realTime_checkpageadvanced").css("display","none");
    	if($("#realTime_checkpageadvanced input[name='realTime_checkpage']:checked").length != 0){
    		$("#realTime_checkpageadvanced input[name='realTime_checkpage']:checked").each(function(i,obj){
				$(obj).attr("checked",false);    		
    			}
    		);
    	}
    	$("#realTime_checkpagenormal input[name='realTime_checkpage']:enabled").each(function(i,obj){
			$(obj).attr("checked",true);
			var selectValues = obj.value;
			var strVal = selectValues.split("|");
			var sConsume = strVal[0];
			pageAmount += realTime_GetFloatValue(sConsume);    	
    		}
    	);
        pageAmount = realTime_GetFloatValue(pageAmount);
    }
	realTime_computeAmount();
}

//选择地区
function realTime_selectPage(obj){
	var plus = 1;
	if($("#top_advancedtype").attr("checked")==true){
		plus = advancedmultiple;
	}
	var selectValues = obj.value;
	var strVal = selectValues.split("|");
	var sConsume = strVal[0];
	if(obj.checked){
		pageAmount += realTime_GetFloatValue(sConsume * plus);
	}else{
		pageAmount -= realTime_GetFloatValue(sConsume * plus);
	}
	pageAmount = realTime_GetFloatValue(pageAmount);
	$("#realTime_PageAmount").val(pageAmount);
	//alert($("#realTime_PageAmount").val());
	realTime_computeAmount();
}

//委托置顶选择地区
function reserve_selectPage(obj){
	var selectValues = obj.value;
	var strVal = selectValues.split("|");
	var sConsume = strVal[0];
	if(obj.checked){
		reservepageAmount += realTime_GetFloatValue(sConsume);
	}else{
		reservepageAmount -= realTime_GetFloatValue(sConsume);
	}
	reservepageAmount = realTime_GetFloatValue(reservepageAmount);
	$("#reserve_PageAmount").val(reservepageAmount);
	//alert($("#realTime_PageAmount").val());
	reserve_computeAmount();
}

//免费置顶选择地区
function gratis_selectPage(){
	if($("input[name = 'gratis_checkpage']:checked").length == 0){
		$("#ty_btn").attr("onclick","");
		$("#ty_btn").unbind("click");
		$("#em").css("color","#9f9f9f");
	}else{
		if($("#gratis_checkRule").attr("checked")){
			$("#ty_btn").attr("onclick","");
			$("#ty_btn").unbind("click");
			$("#ty_btn").bind('click',function(){setGratisTop();});
			$("#em").css("color","#FFF");	
		}
	}
}

//选择时间
function realTime_selectTime(obj){
	var timeLength = obj.value;
	timeLength = parseInt(timeLength);
	selectTime = timeLength;
	$("#realTime_FirstTimeLength").val(timeLength);
	$("#realTime_customLength").val("");
	realTime_computeAmount();
}

//委托置顶选择时间
function reserve_selectTime(obj){
	var timeLength = obj.value;
	timeLength = parseInt(timeLength);
	reserveselectTime = timeLength;
	$("#reserve_FirstTimeLength").val(reserveselectTime);
	$("#reserve_setLength").html(reserveselectTime);
	$("#reserve_customLength").val("");
	reserve_computeAmount();
}

//免费置顶选择时间
function gratis_selectTime(obj){
	var timeLength = obj.value;
	var time = obj.id.split("#")[1];
	timeLength = parseInt(timeLength);
	$("#gratis_FirstTimeLength").val(timeLength);
	$("#time_content").html("请在<b>"+time+"</b>前使用。");
}

//自定义时间
function realTime_textChange(obj){
	
	obj.value=obj.value.replace(/\D+|^0*/g,'');
	
	var timelength = obj.value.length;
	if(timelength > 4){
		obj.value = obj.value.substring(0,4);
	}

	var va = 0;
	if(obj.value !== ""){
		va = obj.value;
	}
	
	$("#realtime_timelengthcustom").attr("checked",true);
	var timeL = parseInt(va);
	selectTime = timeL;
	$("#realTime_FirstTimeLength").val(timeL);
	realTime_computeAmount();
}

//委托置顶自定义时间
function reserve_textChange(obj){
	
	obj.value=obj.value.replace(/\D+|^0*/g,'');
	
	var timelength = obj.value.length;
	if(timelength > 4){
		obj.value = obj.value.substring(0,4);
	}

	var va = 0;
	if(obj.value !== ""){
		va = obj.value;
	}
	
	$("#reserve_timelengthcustom").attr("checked",true);
	var timeL = parseInt(va);
	reserveselectTime = timeL;
	$("#reserve_FirstTimeLength").val(timeL);
	$("#reserve_setLength").html(timeL);
	reserve_computeAmount();
}

//委托置顶置顶小时变更
function reserve_hourChange(obj){
	var hour = obj.value;
	var minute = $("#startminute").val();
	$("#reserve_startTimehour").html(hour+":"+minute);
	
}

//委托置顶置顶分钟变更
function reserve_minuteChange(obj){
	var minute = obj.value;
	var hour = $("#starthour").val();
	$("#reserve_startTimehour").html(hour+":"+minute);

}

//委托置顶天数变更
function reserveDayChange(obj){
	var currDays=parseInt(obj.value);
    var date = new Date();
    date.setDate(date.getDate() + currDays);
    var year = date.getFullYear();
    var m = date.getMonth() + 1;
	var month = (m < 10) ? '0' + m : m;
	var d  = date.getDate();
	var day = (d < 10) ? '0' + d : d;
	var endtime = year+"-"+month+"-"+day;
	$("#reserve_endtime").html(endtime);
}

//计算所需的金额
function realTime_computeAmount(){
	var amountCount = realTime_GetFloatValue(pageAmount * selectTime);
	
	if(amountCount <= 0 ){
	$("#realTime_textArea").css("display","none");
	
	$("#realTime_top").attr("disabled","disabled");
	$("#realTime_top").css("color","#9f9f9f");
	$("#realTime_pay").attr("disabled","disabled");
	$("#realTime_pay").css("color","#9f9f9f");	
	$("#realTime_topNoScore").attr("disabled","disabled");
	$("#realTime_topNoScore").css("color","#9f9f9f");
	}else{
	$("#realTime_textArea").css("display","");
	$("#realTime_AmountCount").html(amountCount);
	
		if(userAmount < amountCount){
		$("#realTime_buzu").css("display","");
		var need = realTime_GetFloatValue(amountCount - userAmount);
		$("#realTime_pay").val("马上充值"+need+"元，完成置顶");
		$("#realTime_topLabel").css("display","none");
		$("#realTime_top").css("display","none");
		$("#realTime_payLabel").css("display","");
		$("#realTime_pay").css("display","");
			if($("#realTime_checkRule").attr("checked")){
			$("#realTime_pay").removeAttr("disabled");
			$("#realTime_pay").css("color","");	
			$("#realTime_topNoScore").removeAttr("disabled");
			$("#realTime_topNoScore").css("color","");	
			}
		}else{
		$("#realTime_buzu").css("display","none");
		$("#realTime_topLabel").css("display","");
		$("#realTime_top").css("display","");
		$("#realTime_payLabel").css("display","none");
		$("#realTime_pay").css("display","none");
			if($("#realTime_checkRule").attr("checked")){
			$("#realTime_top").removeAttr("disabled");
			$("#realTime_top").css("color","");
			$("#realTime_topNoScore").removeAttr("disabled");
			$("#realTime_topNoScore").css("color","");	
			}
		}
	}
	
	resetIframe();
}

//计算委托所需金额
function reserve_computeAmount(){
	var amountCount = realTime_GetFloatValue(reservepageAmount * reserveselectTime);
	var selectDay = parseInt($("#reserve_days").val());
	var allAmount = realTime_GetFloatValue(selectDay*reservepageAmount*reserveselectTime);
	
	if(amountCount <= 0 ){
	$("#reserve_textArea").css("display","none");
	
	$("#reserve_top").attr("disabled","disabled");
	$("#reserve_top").css("color","#9f9f9f");
	$("#reserve_pay").attr("disabled","disabled");
	$("#reserve_pay").css("color","#9f9f9f");	
	$("#reserve_topNoScore").attr("disabled","disabled");
	$("#reserve_topNoScore").css("color","#9f9f9f");
	}else{
	$("#reserve_textArea").css("display","");
	$("#reserve_dayAmount").html(amountCount);
	
		if(userAmount < amountCount){
		$("#reserve_Notop").css("display","");
		$("#reserve_cantop").css("display","none");
		var need = realTime_GetFloatValue(allAmount - userAmount);
		$("#reserve_pay").val("马上充值"+need+"元，完成委托");
		$("#reserve_topLabel").css("display","none");
		$("#reserve_top").css("display","none");
		$("#reserve_payLabel").css("display","");
		$("#reserve_pay").css("display","");
			if($("#reserve_checkRule").attr("checked")){
			$("#reserve_pay").removeAttr("disabled");
			$("#reserve_pay").css("color","");	
			$("#reserve_topNoScore").removeAttr("disabled");
			$("#reserve_topNoScore").css("color","");	
			}
		}else{
		$("#reserve_Notop").css("display","none");
		var cantopday = parseInt(userAmount/amountCount);
			if(cantopday < selectDay){
			$("#reserve_cantop").css("display","");
			$("#reserve_cantopday").html(cantopday);
			$("#reserve_top").val("暂不充值，完成委托");
			}else{
			$("#reserve_cantop").css("display","none");
			$("#reserve_top").val("我要委托");
			}
		$("#reserve_topLabel").css("display","");
		$("#reserve_top").css("display","");
		$("#reserve_payLabel").css("display","none");
		$("#reserve_pay").css("display","none");
			if($("#reserve_checkRule").attr("checked")){
			$("#reserve_top").removeAttr("disabled");
			$("#reserve_top").css("color","");
			$("#reserve_topNoScore").removeAttr("disabled");
			$("#reserve_topNoScore").css("color","");	
			}
		}
	}
	resetIframe();
}

//规则改变
function realTime_ruleChange(obj){
	if(obj.checked&&pageAmount!=0){
		$("#realTime_top").removeAttr("disabled");
		$("#realTime_top").css("color","");
		$("#realTime_pay").removeAttr("disabled");
		$("#realTime_pay").css("color","");	
		$("#realTime_topNoScore").removeAttr("disabled");
		$("#realTime_topNoScore").css("color","");
	}else{
		$("#realTime_top").attr("disabled","disabled");
		$("#realTime_top").css("color","#9f9f9f");
		$("#realTime_pay").attr("disabled","disabled");
		$("#realTime_pay").css("color","#9f9f9f");
		$("#realTime_topNoScore").attr("disabled","disabled");
		$("#realTime_topNoScore").css("color","#9f9f9f");
	}
	
}

//委托规则改变
function reserve_ruleChange(obj){
	if(obj.checked&&reservepageAmount!=0){
		$("#reserve_top").removeAttr("disabled");
		$("#reserve_top").css("color","");
		$("#reserve_pay").removeAttr("disabled");
		$("#reserve_pay").css("color","");	
		$("#reserve_topNoScore").removeAttr("disabled");
		$("#reserve_topNoScore").css("color","");
	}else{
		$("#reserve_top").attr("disabled","disabled");
		$("#reserve_top").css("color","#9f9f9f");
		$("#reserve_pay").attr("disabled","disabled");
		$("#reserve_pay").css("color","#9f9f9f");
		$("#reserve_topNoScore").attr("disabled","disabled");
		$("#reserve_topNoScore").css("color","#9f9f9f");
	}
}

//免费规则改变
function gratis_ruleChange(obj){
	var checkpage = $("input[name = 'gratis_checkpage']:checked").length;
	if(obj.checked&&checkpage!=0){
		$("#ty_btn").bind('click',function(){setGratisTop();});
		$("#em").css("color","#FFF");
	}else{
		$("#ty_btn").attr("onclick","");
		$("#ty_btn").unbind("click");
		$("#em").css("color","#9f9f9f");
	}
}

//乘积变成2位小数
function realTime_GetFloatValue(flv) {
    flv = parseFloat(flv);
    var strFlv = flv.toFixed(2);
    return parseFloat(strFlv);
}


//结束置顶
function setInfoNoTop(argument){
	var arrInfos = argument.split("_");
	var localId = arrInfos[1];
	var topNum = parseInt(arrInfos[2]);
	var infoId = $("#realTime_infoId").val();
	var userId = $("#realTime_userId").val();
	var cateId = $("#realTime_cateId").val();
	var userIP = $("#realTime_userIP").val();
	var controlArea = $("#realTime_controlArea").val();
	var adminName = $("#realTime_AdminName").val();
	var adminKey = $("#realTime_adminKey").val();
	$.post(path+"/setinfonotop",{
		infoId : infoId,
		userId : userId,
		localId : localId,
		cateId : cateId,
		userIP : userIP,
		controlArea : controlArea,
		adminName : adminName,
		adminKey : adminKey
		},function(data){
			//alert(data);
			if(data == "success"){
			alert("结束置顶成功");
			topNum -= 1;
			refresh(0);
			parent.topOperateResult(3,topNum,infoId,0);//isTop  1,2,3,4  1表示置顶操作,2委托，3取消置顶，4取消委托result 1 或0  1表示成功
			}else{
			alert("结束置顶失败："+data);
			return
			}
		
		},"json");
}

//结束委托
function setInfoNoReserve(argument){
	var arrInfos = argument.split("_");
	var localId = arrInfos[1];
	var reserveNum = parseInt(arrInfos[2]);
	var infoId = $("#realTime_infoId").val();
	var userId = $("#realTime_userId").val();
	var cateId = $("#realTime_cateId").val();
	var userIP = $("#realTime_userIP").val();
	var controlArea = $("#realTime_controlArea").val();
	var adminName = $("#realTime_AdminName").val();
	var adminKey = $("#realTime_adminKey").val();
	$.post(path+"/setinfonoreserve",{
		infoId : infoId,
		userId : userId,
		localId : localId,
		cateId : cateId,
		userIP : userIP,
		controlArea : controlArea,
		adminName : adminName,
		adminKey : adminKey
		},function(data){
			//alert(data);
			if(data == "success"){
			alert("结束委托成功");
			reserveNum -=1;
			refresh(1);
			parent.topOperateResult(4,reserveNum,infoId,0);//isTop  1,2,3,4  1表示置顶操作,2委托，3取消置顶，4取消委托result 1 或0  1表示成功
			}else{
			alert("结束委托失败："+data);
			return
			}
		
		},"json");
}

//设置置顶
function setInfoTop(adm){
	var checkpage="";
	$("input[name = 'realTime_checkpage']:checked").each(function(i,obj){
		if(checkpage != "" ){
		checkpage += (","+obj.value);
		}else{
		checkpage = obj.value
		}
	});
	var selecttime = $("input[name ='realtime_timelength']:checked").val();
	var userIP = $("#realTime_userIP").val();
	var infoId = $("#realTime_infoId").val();
	var userId = $("#realTime_userId").val();
	var localId = $("#realTime_localId").val();
	var cateId = $("#realTime_cateId").val();
	var adminKey = $("#realTime_adminKey").val();
	var adminName = $("#realTime_adminName").val();
	var controlArea = $("#realTime_controlArea").val();
	var selectType = $("input[name = 'top_type']:checked").val();
	
	if(selecttime == 0){
		selecttime = $("#realTime_customLength").val();
	}
	
	var neddamount = parseFloat($("#realTime_AmountCount").html());
	var leftamount = realTime_GetFloatValue(userAmount - neddamount);
	
	if(adm!=1){
		if($("input[name = 'realTime_gift']").length!=0){
			var len=0;
			$("input[name = 'realTime_gift']").each(function(i,obj){
				if($(obj).siblings("input:checked").length!=0){
					len++;			
				}
			});
			if(len!=0){
			adm=1+len;
			}
		}
	}
	
	$.post(path+"/setinforealtimetop",{
		checkpage : checkpage,
		selecttime : selecttime,
		userIP : userIP,
		infoId : infoId,
		userId : userId,
		localId : localId,
		cateId : cateId,
		adminKey : adminKey,
		adminName : adminName,
		controlArea : controlArea,
		adm : adm,
		selectType : selectType
		},function(data){
			//alert(data);
			if(data == "success"||data=="whatapity"){
				if(data == "success"){
				alert("置顶成功");
				}else{
				alert("很抱歉，本次优惠您可能部分或全部未能参与，可能与操作延时有关。\n您选择的置顶已经操作完成");
				}
				refresh(0);
				parent.topOperateResult(1,1,infoId,leftamount);//isTop  1,2,3,4  1表示置顶操作,2委托，3取消置顶，4取消委托result 1 或0  1表示成功
			}else if(data=="getgift"){
				$.post(path+"/giftshow",{
						infoId : infoId,
						checkpage : checkpage
					},function(data){
						alert(data);
						refresh(0);
						parent.topOperateResult(1,1,infoId,leftamount);//isTop  1,2,3,4  1表示置顶操作,2委托，3取消置顶，4取消委托result 1 或0  1表示成功
					},"json");
			}else{
				alert("置顶失败："+data);
				return
			}
		},"json");

}

//设置免费置顶
function setGratisTop(){
	var checkpage="";
	$("input[name = 'gratis_checkpage']:checked").each(function(i,obj){
		if(checkpage != "" ){
		checkpage += (","+obj.value);
		}else{
		checkpage = obj.value
		}
	});
	var selecttime = $("input[name ='gratis_timelength']:checked").val();
	var userIP = $("#realTime_userIP").val();
	var infoId = $("#realTime_infoId").val();
	var userId = $("#realTime_userId").val();
	var localId = $("#realTime_localId").val();
	var cateId = $("#realTime_cateId").val();
	var adminName = $("#realTime_adminName").val();
	
	$.post(path+"/setgratistop",{
		checkpage : checkpage,
		selecttime : selecttime,
		userIP : userIP,
		infoId : infoId,
		userId : userId,
		localId : localId,
		cateId : cateId,
		adminName : adminName
		},function(data){
			//alert(data);
			if(data == "success"){
			alert("免费置顶成功");
			refresh(0);
			parent.topOperateResult(1,1,infoId,userAmount);//isTop  1,2,3,4  1表示置顶操作,2委托，3取消置顶，4取消委托result 1 或0  1表示成功
			}else{
			alert("免费置顶失败："+data);
			return
			}
		},"json");

}

//设置委托
function setInfoReserve(adm){
	var checkpage="";
	$("input[name = 'reserve_checkpage']:checked").each(function(i,obj){
		if(checkpage != "" ){
		checkpage += (","+obj.value);
		}else{
		checkpage = obj.value
		}
	});
	var selecttime = $("input[name ='reserve_timelength']:checked").val();
	var setdays = $("#reserve_days").val();
	var hour = $("#starthour").val();
	var minute = $("#startminute").val();
	var userIP = $("#realTime_userIP").val();
	var infoId = $("#realTime_infoId").val();
	var userId = $("#realTime_userId").val();
	var localId = $("#realTime_localId").val();
	var cateId = $("#realTime_cateId").val();
	var adminKey = $("#realTime_adminKey").val();
	var adminName = $("#realTime_adminName").val();
	var controlArea = $("#realTime_controlArea").val();
	
	if(selecttime == 0){
		selecttime = $("#reserve_customLength").val();
	}
	
	$.post(path+"/setreservetop",{
		checkpage : checkpage,
		selecttime : selecttime,
		setdays : setdays,
		minute : minute,
		hour : hour,
		userIP : userIP,
		infoId : infoId,
		userId : userId,
		localId : localId,
		cateId : cateId,
		adminKey : adminKey,
		adminName : adminName,
		controlArea : controlArea,
		adm : adm
		},function(data){
			//alert(data);
			if(data == "success"){
			alert("委托置顶成功");
			refresh(1);
			parent.topOperateResult(2,1,infoId,0);//isTop  1,2,3,4  1表示置顶操作,2委托，3取消置顶，4取消委托result 1 或0  1表示成功
			}else{
			alert("置顶失败："+data);
			return
			}
		},"json");

}

//付费并置顶
function payAndTop(){
	var checkpage="";
	$("input[name = 'realTime_checkpage']:checked").each(function(i,obj){
		if(checkpage != "" ){
		checkpage += (","+obj.value);
		}else{
		checkpage = obj.value
		}
	});
	var selecttime = $("input[name ='realtime_timelength']:checked").val();
	var userIP = $("#realTime_userIP").val();
	var infoId = $("#realTime_infoId").val();
	var userId = $("#realTime_userId").val();
	var localId = $("#realTime_localId").val();
	var cateId = $("#realTime_cateId").val();
	var adminName = $("#realTime_adminName").val();
	var controlArea = $("#realTime_controlArea").val();
	var selectType = $("input[name = 'top_type']:checked").val();
	
	if(selecttime == 0){
		selecttime = $("#realTime_customLength").val();
	}
	
	$.post(path+"/payinfotop",{
		checkpage : checkpage,
		selecttime : selecttime,
		userIP : userIP,
		infoId : infoId,
		userId : userId,
		localId : localId,
		cateId : cateId,
		adminName : adminName,
		selectType : selectType,
		userAmount : userAmount,
		controlArea : controlArea,
		advancedmultiple : advancedmultiple
		},function(data){
			//alert(data);
			if(data == ""){
				alert("数据出错");
				window.location.reload(true);
			}else{
				window.top.location.href=data;
			}
		},"json");
	
}

//付费并委托
function payAndReserve(){
	var checkpage="";
	$("input[name = 'reserve_checkpage']:checked").each(function(i,obj){
		if(checkpage != "" ){
		checkpage += (","+obj.value);
		}else{
		checkpage = obj.value
		}
	});
	var selecttime = $("input[name ='reserve_timelength']:checked").val();
	var setdays = $("#reserve_days").val();
	var hour = $("#starthour").val();
	var minute = $("#startminute").val();
	var userIP = $("#realTime_userIP").val();
	var infoId = $("#realTime_infoId").val();
	var userId = $("#realTime_userId").val();
	var localId = $("#realTime_localId").val();
	var cateId = $("#realTime_cateId").val();
	var adminName = $("#realTime_adminName").val();
	var controlArea = $("#realTime_controlArea").val();
	
	if(selecttime == 0){
		selecttime = $("#reserve_customLength").val();
	}
	
	$.post(path+"/payreservetop",{
		checkpage : checkpage,
		selecttime : selecttime,
		setdays : setdays,
		minute : minute,
		hour : hour,
		userIP : userIP,
		infoId : infoId,
		userId : userId,
		localId : localId,
		cateId : cateId,
		userAmount : userAmount,
		adminName : adminName,
		controlArea : controlArea
		},function(data){
			//alert(data);
			if(data == ""){
				alert("数据出错");
				window.location.reload(true);
			}else{
				window.top.location.href=data;
			}
		},"json");

}

</script>
  
</head>

<body>

	<div class="mbottom">
		<div class="newzd"> 
			<div class="zdbody">
			<!-- 置顶主体开始 -->
				<div class="zdtit" id="menu1">
					<ul>
						<li class="select" id="menu1_title0" onclick="nTabs(0,this);"><span>置顶</span></li>
												<li id="menu1_title1" onclick="nTabs(1,this);"><span>委托置顶</span></li>
																	</ul>
				</div>
				<div class="clear"></div>
				<div class="zdinfo">
					<input id="realTime_infoId" value="7273730350982" type="hidden">
										<input id="realTime_path" value="/infotopnet" type="hidden">
					<input id="newUseramount" value="0.0" type="hidden">
					<input id="realTime_userId" value="17814094" type="hidden">
					<input id="realTime_localId" value="1237" type="hidden">
					<input id="realTime_cateId" value="35" type="hidden">
					<input id="realTime_controlArea" value="2" type="hidden">
					<input id="realTime_adminKey" value="" type="hidden">
					<input id="realTime_adminName" value="" type="hidden">
					<input id="realTime_userIP" value="210.82.55.173" type="hidden">
					<input id="showUrl" value="$showUrl" type="hidden">
										<!-- 实时置顶部分开始 -->
					<div id="menu1_content0">
						<div id="top_content0">
														<div class="nowzdts">
							<p><font color="red" size="2pt">【好消息】年末终极感恩！惠普笔记本、SONY相机、九阳豆浆机免费拿！更多奖品等着你！<a href="http://q.58.com/58zhiding/topic_763522.shtml" target="_blank">了解活动详情</a></font></p>
<p><font size="2pt">即日起，58同城置顶服务将使用智能价格机制，系统将于每周三凌晨根据相关数据自动调整价格，<a href="http://q.58.com/58zhiding/topic_712821.shtml" target="_blank">了解更多</a></font></p>

							</div>
							<div class="clear"></div>
							<div class="zdline"></div>
														
															
														
														
														<div class="tjzd">
								<b class="f14">未置顶的页面，马上置顶：</b><br>
								
																
								<table class="tjzdtable" border="0" cellpadding="0" cellspacing="0">
																<tbody><tr>
									<td class="tdwt"><input name="top_type" id="top_normaltype" value="normal" onclick="realTime_selectType(this)" checked="checked" type="radio">普通置顶&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
									<td><input name="top_type" id="top_advancedtype" value="advanced" onclick="realTime_selectType(this)" type="radio">高级置顶<img src="0_data/btn-2-new.gif">（固定展示在置顶前5位）
								</td></tr>
																<input name="top_advancedmultiple" id="top_advancedmultiple" value="2.0" type="hidden">
								<tr>
									<td class="tdwt" width="198"> 选择置顶页面：</td>
									<td>
										<div id="realTime_checkpagenormal">
																																																																	<p><input name="realTime_checkpage" checked="checked" onclick="realTime_selectPage(this)" value="1.8|1" type="checkbox">北京-二手电脑/配件(<a href="http://bj.58.com/diannao" target="_blank">查看页面</a>)
								    
								                        			    
																		<span style="color:red;font-size:14px"></span>
																										</p>
																																																																							<p><input name="realTime_checkpage" checked="checked" onclick="realTime_selectPage(this)" value="1.4|1143" type="checkbox">海淀-二手电脑/配件(<a href="http://bj.58.com/haidian/diannao" target="_blank">查看页面</a>)
								    
								                        			    
																		<span style="color:red;font-size:14px"></span>
																										</p>
																																																																							<p><input name="realTime_checkpage" checked="checked" onclick="realTime_selectPage(this)" value="0.5|1237" type="checkbox">清华大学-二手电脑/配件(<a href="http://bj.58.com/qinghuadaxue/diannao" target="_blank">查看页面</a>)
								    
								                        			    
																		<span style="color:red;font-size:14px"></span>
																										</p>
																																				</div>
																				<div id="realTime_checkpageadvanced" style="display:none;">
																																																							<p><input name="realTime_checkpage" onclick="realTime_selectPage(this)" value="1.8|1" type="checkbox">北京-二手电脑/配件(<a href="http://bj.58.com/diannao" target="_blank">查看页面</a>)
								    
								                        			    
																		<span style="color:red;font-size:14px"></span>
																										</p>
																																																																							<p><input name="realTime_checkpage" onclick="realTime_selectPage(this)" value="1.4|1143" type="checkbox">海淀-二手电脑/配件(<a href="http://bj.58.com/haidian/diannao" target="_blank">查看页面</a>)
								    
								                        			    
																		<span style="color:red;font-size:14px"></span>
																										</p>
																																																																							<p><input name="realTime_checkpage" onclick="realTime_selectPage(this)" value="0.5|1237" type="checkbox">清华大学-二手电脑/配件(<a href="http://bj.58.com/qinghuadaxue/diannao" target="_blank">查看页面</a>)
								    
								                        			    
																		<span style="color:red;font-size:14px"></span>
																										</p>
																																				</div>
																				<input id="realTime_PageAmount" value="3.6999998" type="hidden">
									</td>
								</tr>
								<tr>
									<td class="tdwt">选择置顶时长： </td> 
									<td>
																											<input name="realtime_timelength" onclick="realTime_selectTime(this)" id="realtime_timelength1" value="6" checked="checked" type="radio">6小时
																																				<input name="realtime_timelength" onclick="realTime_selectTime(this)" id="realtime_timelength2" value="16" type="radio">16小时
																																				<input name="realtime_timelength" onclick="realTime_selectTime(this)" id="realtime_timelength3" value="72" type="radio">3天
																																				<input name="realtime_timelength" onclick="realTime_selectTime(this)" id="realtime_timelength4" value="360" type="radio">15天
																																				<input name="realtime_timelength" onclick="realTime_selectTime(this)" id="realtime_timelength5" value="720" type="radio">30天
																											
																		<input id="realTime_FirstTimeLength" value="6" type="hidden">
									<div style="width:500px;height:1px;overflow:hidden;"></div>
									</td>
								</tr>
								<tr id="realTime_textArea">
									<td colspan="2">
										<div class="yellow-b">
										<table border="0" width="100%">
										<tbody><tr>
																						<td>此次置顶需要花费您<span class="red" id="realTime_AmountCount">22.2</span>元，
												<span id="realTime_tishi">您的可用余额为<span class="red" id="realTime_UserAmount">0.0</span>元。</span>
												<span id="realTime_buzu">余额不足</span>
											</td>
										</tr>
										</tbody></table>
										</div>
									</td>
								</tr>
								<tr>
									<td class="tdwt">&nbsp;</td>
									<td><span class="tyzdbut">
									<input name="" onclick="realTime_ruleChange(this)" id="realTime_checkRule" value="" checked="checked" type="checkbox"> 同意<a href="http://about.58.com/56.html?categid=1#h" target="_blank">置顶规则</a>
									&nbsp;<label style="display: none;" class="butt" id="realTime_topLabel">
										  <input style="display: none;" name="" id="realTime_top" value="马上置顶" class="btns" onclick="setInfoTop(0);this.disabled='disabled'" type="button">
										  </label>
										  <label class="butt" id="realTime_payLabel" style="">
										  <input name="" id="realTime_pay" value="马上充值22.2元，完成置顶" class="btns" onclick="payAndTop();this.disabled='disabled'" style="" type="button">
										  </label>
										  							              							              <label class="butt" style="display:none;">
							              <input name="" id="realTime_topNoScore" value="免费置顶" class="btns" onclick="setInfoTop(1);this.disabled='disabled'" style="display: none;" type="button">
							              </label>
									</span>
									</td>
								</tr>
								</tbody></table>
							</div>
																											</div>
					</div>
					<!-- 实时置顶部分结束 -->
					
					<!-- 委托置顶部分开始-->
										<div id="menu1_content1" style="display:none">
						<div id="top_content1">
														<div class="nowzdts">
							<p><font font="" color="red" size="2pt">【好消息】年末终极感恩！惠普笔记本、SONY相机、九阳豆浆机免费拿！更多奖品等着你！<a href="http://q.58.com/58zhiding/topic_763522.shtml" target="_blank">了解活动详情</a></font></p>
							</div>
							<div class="clear"></div>
							<div class="zdline"></div>
														
														
														
														<div class="tjzd">
								<b class="f14">未委托的页面，马上委托：</b><br>
								<table class="tjzdtable" border="0" cellpadding="0" cellspacing="0">
								<tbody><tr><td class="tdwt" width="200"> 选择委托页面：</td>
									<td>
																											<p><input name="reserve_checkpage" checked="checked" onclick="reserve_selectPage(this)" value="1.8|1" type="checkbox">北京-二手电脑/配件(<a href="http://bj.58.com/diannao/" target="_blank">查看页面</a>)</p>
																		<p><input name="reserve_checkpage" checked="checked" onclick="reserve_selectPage(this)" value="1.4|1143" type="checkbox">海淀-二手电脑/配件(<a href="http://bj.58.com/haidian/diannao/" target="_blank">查看页面</a>)</p>
																		<p><input name="reserve_checkpage" checked="checked" onclick="reserve_selectPage(this)" value="0.5|1237" type="checkbox">清华大学-二手电脑/配件(<a href="http://bj.58.com/qinghuadaxue/diannao/" target="_blank">查看页面</a>)</p>
																		<input id="reserve_PageAmount" value="3.6999998" type="hidden">
									</td>
								</tr>
								<tr><td class="tdwt"> 委托开始时间：</td>
									<td> 明日
									<select id="starthour" name="starthour" onchange="reserve_hourChange(this)">
																																				<option value="00">0</option>
																																				<option value="01">1</option>
																																				<option value="02">2</option>
																																				<option value="03">3</option>
																																				<option value="04">4</option>
																																				<option value="05">5</option>
																																				<option value="06">6</option>
																																				<option value="07">7</option>
																																				<option value="08" selected="selected">8</option>
																																				<option value="09">9</option>
																																				<option value="10">10</option>
																																				<option value="11">11</option>
																																				<option value="12">12</option>
																																				<option value="13">13</option>
																																				<option value="14">14</option>
																																				<option value="15">15</option>
																																				<option value="16">16</option>
																																				<option value="17">17</option>
																																				<option value="18">18</option>
																																				<option value="19">19</option>
																																				<option value="20">20</option>
																																				<option value="21">21</option>
																																				<option value="22">22</option>
																																				<option value="23">23</option>
																											</select> 时 &nbsp;
									<select id="startminute" name="startminute" onchange="reserve_minuteChange(this)">
									<option selected="selected" value="00">0</option>
									<option value="05">5</option>
									<option value="10">10</option>
									<option value="15">15</option>
									<option value="20">20</option>
									<option value="25">25</option>
									<option value="30">30</option>
									<option value="35">35</option>
									<option value="40">40</option>
									<option value="45">45</option>
									<option value="50">50</option>
									<option value="55">55</option>
									</select>分 开始置顶
									</td>
								</tr>
								<tr><td class="tdwt">每天置顶时长： </td>
									<td>
																											<input name="reserve_timelength" onclick="reserve_selectTime(this)" id="reserve_timelength1" value="3" type="radio">3小时
																																				<input name="reserve_timelength" onclick="reserve_selectTime(this)" id="reserve_timelength2" value="6" checked="checked" type="radio">6小时
																																				<input name="reserve_timelength" onclick="reserve_selectTime(this)" id="reserve_timelength3" value="12" type="radio">12小时
																																				<input name="reserve_timelength" onclick="reserve_selectTime(this)" id="reserve_timelength4" value="16" type="radio">16小时
																																				<input name="reserve_timelength" onclick="reserve_selectTime(this)" id="reserve_timelength5" value="18" type="radio">18小时
																											
																		<input id="reserve_FirstTimeLength" value="6" type="hidden">
									</td>
								</tr>
								<tr><td class="tdwt">委托持续天数： </td>
									<td>
									<select id="reserve_days" name="reserve_days" onchange="reserveDayChange(this)">
																											<option value="1" selected="selected">1</option>
																																				<option value="3">3</option>
																																				<option value="10">10</option>
																																				<option value="20">20</option>
																																				<option value="30">30</option>
																											</select>&nbsp;天
									<span class="gray mr10">您选择的置顶时间为<b class="red">
																		
									
									2012-01-02
									</b>至<b class="red" id="reserve_endtime">
									
									
									2012-01-02
									</b>每日<b class="red" id="reserve_startTimehour">08:00</b>起置顶<b class="red" id="reserve_setLength">6</b>小时</span>
									</td>
								</tr>
								<tr id="reserve_textArea">
									<td colspan="2">
									<div class="yellow-b">
																		<span class="hfsj">此次委托预计<span class="red">每天</span>花费<span class="red" id="reserve_dayAmount">22.2</span>元，您可用余额为<span class="red" id="reserve_UserAmount">0.0</span>元。
									<span id="reserve_Notop" class="red">余额不足</span>
									<span style="display: none;" id="reserve_cantop">可委托<span id="reserve_cantopday">0</span>天，<a href="http://paycenter.58.com/torecharge" target="_blank">点击充值</a></span>
									<br>
									<span class="smallfont">提示：置顶价格每周三进行调整，委托扣费以实时价格为准。</span>
									</span>
									</div>
									</td>
								</tr>
								<tr><td class="tdwt">&nbsp;</td>
									<td><span class="tyzdbut">
									<input name="" onclick="reserve_ruleChange(this)" id="reserve_checkRule" value="" checked="checked" type="checkbox"> 同意<a href="http://about.58.com/56.html?categid=1#h" target="_blank">置顶规则</a>
									&nbsp;<label style="display: none;" class="butt" id="reserve_topLabel"><input style="display: none;" name="" id="reserve_top" value="11" class="btns" onclick="setInfoReserve(0);this.disabled='disabled';" type="button"></label>
										  <label class="butt" id="reserve_payLabel"><input name="" id="reserve_pay" value="马上充值22.2元，完成委托" class="btns" onclick="payAndReserve();this.disabled='disabled';" type="button"></label>
										  							              							              <label class="butt" style="display:none;"><input name="" id="reserve_topNoScore" value="免费委托" class="btns" onclick="setInfoReserve(1);this.disabled='disabled';" style="display: none;" type="button"></label>
									</span></td>
								</tr>
								</tbody></table>
							</div>
																				</div>
					</div>
					<!-- 委托置顶部分结束-->
					
					<!-- 免费置顶部分开始-->
					<div id="menu1_content2" class="mf-box" style="display:none">
						<div id="top_content2">
													</div>
					</div>
										<!-- 免费置顶部分结束-->
	
				</div>
			<!-- 置顶主体结束 -->
			</div>
		</div>
	</div>
	


<script>
document.domain ="58.com"; 
function resetIframe(){
	var inId = $("#realTime_infoId").val();
	var iframeId = "frm"+inId;
	_iframearea = parent.window.document.getElementById(iframeId);
//	var newheight = Math.max(_iframearea.contentWindow.document.documentElement.scrollHeight, _iframearea.contentWindow.document.body.scrollHeight);
	var newheight = _iframearea.contentWindow.document.body.scrollHeight;
	setframeheight(iframeId,newheight);

}

function setframeheight(frmID, height) {
    var frm = parent.$("#" + frmID);
    height = height + 30;
    if (frm.length > 0) {
        if (navigator.userAgent.toLowerCase().indexOf("msie") == -1) {
            frm.css("height", height + "px");
        }
        else {
            frm.css("height", height + "px");                
        }
    }
}

function nTabs(index, obj){
	for (i = 0; i < 3; i++) {
        if (i == index) {
            $("#menu1_title" + i).attr("class","select");
            $("#menu1_content" + i).css("display","");
        }
        else {
            $("#menu1_title" + i).removeClass("select");
            $("#menu1_content" + i).css("display","none");
        }    
    }
	resetIframe();
}

function selectContent(){
	if($("#showUrl").val()==1){
			nTabs(1);
	}
}

function refresh(index){
	var url = window.location.href;
	if(index == 0){
		if(url.indexOf("?")!= -1){
			url = url.substring(0,url.lastIndexOf("/"));		
		}
		window.location.href=url;
	}else{
		if(url.indexOf("?")==-1){
			url +="/?showurl=1";
		}
		window.location.href=url;
	}
}
</script>

</body></html>